<?php
require('db.php');

$vak = $_GET['vak'];
$competentieID = $_GET['competentieID'];

$result = mysql_query("select vakID, competentieID, zeerGoed, goed, voldoende, onvoldoende from indicatoren WHERE vakID=(SELECT id FROM vak WHERE naam='$vak') and competentieID=$competentieID") or die (mysql_error());

$data = array();

while ($row = mysql_fetch_object($result)) {
    $data [] = $row;
}

echo json_encode($data);
?>